<?php 
	class Logins extends CI_Model{

	 	function __construct(){
        	parent::__construct();
    	}

    	//检测用户名是否存在
		function check_username($username){
			$sql = "select id, rand_str from ".$this->db->dbprefix('sys_users')." where username = '".$username."'";
			$result = $this->db->query($sql)->row_array();
			return $result;
		}

		//检测用户名密码是否正确
		function chaeck_password($id,$password){
			$sql = "select id, role_id from ".$this->db->dbprefix('sys_users')." where id = ".$id." and password = '".$password."'";
			$result = $this->db->query($sql)->row_array();
			return $result;
		}

		function check_user_password($id,$password){
			$sql = "select id from ".$this->db->dbprefix('user')." where id = ".$id." and password = '".$password."'";
			$result = $this->db->query($sql)->row_array();
			return $result;
		}

		//检测用户是否被禁用
		function chaeck_is_disable($id,$password){
			$sql = "select id, role_id from ".$this->db->dbprefix('sys_users')." where id = ".$id." and password = '".$password."' and status = 0";
			$result = $this->db->query($sql)->row_array();
			return $result;
		}
	}